/**
* @file time_covert.cpp in rtkpost
* @author rebeater
* @comment
* Create on 12/31/21 3:40 PM
* @version 1.0
**/
#include <stdarg.h>
#include <math.h>
#include "rtklib.h"

#define PROGNAME    "rnx2rtkp"          /* program name */
#define MAXFILE     16                  /* max number of input files */

/* show message --------------------------------------------------------------*/
extern int showmsg(char *format, ...) {
  va_list arg;
  va_start(arg, format);
  vfprintf(stderr, format, arg);
  va_end(arg);
  fprintf(stderr, "\r");
  return 0;
}
extern void settspan(gtime_t ts, gtime_t te) {}
extern void settime(gtime_t time) {}

int main() {
  char buffer[256];
  char rmc[] = "$GPRMC,034700.00,A,3958.88855127,N,11619.29983919,E,2.415,273.7,020322,7.0,W,D*";
  int tail = sprintf(buffer,"%s", rmc);
  unsigned char sum = 0;
  for (int i = 1; i < tail - 1; ++i) {
    sum ^= buffer[i];
  }

/*  for(auto & i:rmc){
    sum += i;
  }*/
  printf("sum = %2X\n", (int)sum);

  time_t t = 1638665219;
  gtime_t gt = {t, 0};
  time2str(gt, buffer, 3);
  printf("%s\n", buffer);
}